(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/script/PrefabBtn.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'af72aD851FHk4kIRSu4NdNG', 'PrefabBtn', __filename);
// script/PrefabBtn.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {},

    onLoad: function onLoad() {
        this.initInfor();
    },
    initInfor: function initInfor() {
        var name = this.node.getChildByName("label").getComponent(cc.Sprite).spriteFrame.name;
        this.type = name.split('_')[1];
        this.node.getChildByName("guigold").active = false;
        var guigold = this.node.getChildByName("guigold").getComponent(cc.Sprite);
        var gold = this.node.getChildByName("gold").getComponent(cc.Label);
        gold.string = cc.vv.GOLDCOIN;
        var silver = this.node.getChildByName("silver").getComponent(cc.Label);
        silver.string = cc.vv.SILVERCOIN;
        var copper = this.node.getChildByName("copper").getComponent(cc.Label);
        copper.string = cc.vv.COPPERCOIN;
        var coin = this.node.getChildByName("coin").getComponent(cc.Label);
        var death = this.node.getChildByName("death").getComponent(cc.Label);
        this.getInfor(coin, death, this.type);
    },
    getInfor: function getInfor(coin, death, type) {
        cc.log(type);
        // coin.string = cc.sys.localStorage.getItem("stageCoin" + type) === null ? 0 : cc.sys.localStorage.getItem("stageCoin" + type) + " / " + cc.vv.CoinTotal;
        // death.string = "X " + cc.sys.localStorage.getItem("stageDeath" + type) === null ? 0 : cc.sys.localStorage.getItem("stageDeath" + type);
        if (cc.sys.localStorage.getItem("stageCoin" + type) >= cc.vv.GOLDCOIN) {
            guigold.spriteFrame = cc.vv["gold"];
            this.node.getChildByName("guigold").active = true;
        } else if (cc.sys.localStorage.getItem("stageCoin" + type) >= cc.vv.SILVERCOIN && cc.sys.localStorage.getItem("stageCoin" + type) < cc.vv.GOLDCOIN) {
            guigold.spriteFrame = cc.vv["silver"];
            this.node.getChildByName("guigold").active = true;
        } else if (cc.sys.localStorage.getItem("stageCoin" + type) >= cc.vv.COPPERCOIN && cc.sys.localStorage.getItem("stageCoin" + type) < cc.vv.SILVERCOIN) {
            guigold.spriteFrame = cc.vv["copper"];
            this.node.getChildByName("guigold").active = true;
        }
    },


    /***
     * 进入游戏
     */
    playBtn: function playBtn() {
        var name = this.node.getChildByName("label").getComponent(cc.Sprite).spriteFrame.name;
        var type = name.split('_')[1];
        cc.log(type);
        cc.director.loadScene("stage" + type);
    }
}
// start () {},

// update (dt) {},
);

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=PrefabBtn.js.map
        